package org.cerberus.platform.internal;

import java.util.HashMap;
import java.util.Map;

import org.cerberus.platform.internal.impl.ASCIIProtocol;
import org.cerberus.platform.internal.impl.BinaryProtocol;

public class ProtocolRegistry {

	private static Map<String, IProtocolHandler> protocols = new HashMap<String, IProtocolHandler>();
	static {
		// register default protocols
		register(new ASCIIProtocol());
		register(new BinaryProtocol());
	}
	
	public static void register(IProtocolHandler protocol) {
		protocols.put(protocol.getProtocolID(), protocol);
	}
	
	public static IProtocolHandler get(String id) {
		return protocols.get(id);
	}
	
}
